package com.xiaoyy.core.config.quartz;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 定时任务基类
 * */
public abstract class AbstractTask implements Job {
    protected Logger logger = LoggerFactory.getLogger(this.getClass());
    public abstract void executeInternal(JobExecutionContext context);
    public String cron;
    @Override
    public void execute(JobExecutionContext jobExecutionContext) {
        try {
            executeInternal(jobExecutionContext);
        } catch (Exception e) {
            logger.error(e.getMessage(), e);
            logger.error("job execute failed!");
        }
    }
    public String getCron() {
        return cron;
    }
}
